<?php

namespace App\Http\Requests;


class TopicsForm extends BaseFrom
{

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $validator = [
            'title'       => 'required',
            'category_id' => 'required|numeric',
            'body'        => 'required'
        ];

        $id = $this->input('id');
        if (isset($id)) {

        } else {

        }
        return $validator;
    }

    public function messages()
    {
        return [
            'title.required'       => '请填写文章标题',
            'category_id.required' => '请选择话题分类',
            'category_id.numeric'  => '话题分类应该是数字类型',
            'body.required'        => '请输入一些内容'
        ];
    }
}
